const cloud = require('wx-server-sdk')
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV })

exports.main = async (event, context) => {
  const db = cloud.database()
  try {
    const result = await db.collection('HeroList').get()
    return result.data
  } catch (err) {
    console.error(err)
    return { errCode: 1, errMsg: err }
  }
}